/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package negocio;

/**
 *
 * @author Angelo
 */
public class Column {
    private String column_name;
    private String data_type;
    private int data_length;
    private int data_precision;
    private String nullable;
    private double par_avg_size;
    private double par_percent_null;

    public Column(String column_name, String data_type, int data_length, int data_precision, String nullable, double par_avg_size, double par_percent_null) {
        this.column_name = column_name;
        this.data_type = data_type;
        this.data_length = data_length;
        this.data_precision = data_precision;
        this.nullable = nullable;
        this.par_avg_size = par_avg_size;
        this.par_percent_null = par_percent_null;
    }       

    public String getColumn_name() {
        return column_name;
    }

    public void setColumn_name(String column_name) {
        this.column_name = column_name;
    }

    public String getData_type() {
        return data_type;
    }

    public void setData_type(String data_type) {
        this.data_type = data_type;
    }

    public int getData_length() {
        return data_length;
    }

    public void setData_length(int data_length) {
        this.data_length = data_length;
    }

    public int getData_precision() {
        return data_precision;
    }

    public void setData_precision(int data_precision) {
        this.data_precision = data_precision;
    }

    public String getNullable() {
        return nullable;
    }

    public void setNullable(String nullable) {
        this.nullable = nullable;
    }

    public double getPar_avg_size() {
        return par_avg_size;
    }

    public void setPar_avg_size(double par_avg_size) {
        this.par_avg_size = par_avg_size;
    }

    public double getPar_percent_null() {
        return par_percent_null;
    }

    public void setPar_percent_null(double par_percent_null) throws Exception {        
        if( par_percent_null>0 && !getNullable().equals("Y")){
            throw new Exception("Esta coluna não aceita valor nulo.");
        }                
        this.par_percent_null = par_percent_null;
    }
               
}
